package com.crr.dao.impl;

import com.crr.dao.IceBox;
import com.crr.log.OutOfNumberException;
import org.springframework.stereotype.Component;

@Component
public class IceBoxImpl implements IceBox {

    @Override
    public void buyIceBox(int num) throws OutOfNumberException {
        if (num>1){
            throw new OutOfNumberException("已限购，请勿重复购买");
        }
        System.out.println("购买了一台特价冰箱~~~~~~~");
    }
    public void storeIceBox(int num) throws OutOfNumberException{
        if(num<10){
            throw new OutOfNumberException("库存已不足，需要订货");
        }
        System.out.println("库存充足！！");
    }
}
